import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

import App from '@/App'

import Index from '@/page'
import Home from '@/page/home'
import My from '@/page/my'
import Tool from '@/page/tool'
import HomeN from '@/page/homeN'
import Creditloanrecord from '@/page/creditloanrecord'

import Login from '@/page/account/login'

const routes = [{
        path: '/',
        component: Index,
        redirect: '/home',
        children: [{
            path: 'home',
            name: '首页',
            component: Home
        }, {
            path: 'my',
            name: '我的',
            component: My
        }, {
            path: 'tool',
            name: '工具',
            component: Tool
        }, {
            path: 'homeN',
            name: '新首页',
            component: HomeN
        }, {
            path: 'creditloanrecord',
            name: '贷款记录',
            component: Creditloanrecord
        }, ]
    },
    //账号相关
    {
        path: '/',
        component: App,
        children: [{
            path: 'login',
            name: '登录',
            component: Login
        }, {
            path: 'register',
            name: '注册',
            component: resolve => require(['@/page/account/register'], resolve)
        }, {
            path: 'retrievepassword',
            name: '找回密码',
            component: resolve => require(['@/page/account/retrievepassword'], resolve)
        }]
    },
    //用户相关
    {
        path: '/',
        component: App,
        children: [{
            path: 'personalcenter',
            name: '个人中心',
            component: r => require(['@/page/personalcenter'], r)
        }, {
            path: 'authentication',
            name: '实名认证',
            component: r => require(['@/page/authentication'], r)
        }, {
            path: 'bindingphone',
            name: '绑定手机',
            component: r => require(['@/page/bindingphone'], r)
        }, {
            path: 'loginpassword',
            name: '登录密码',
            component: r => require(['@/page/loginpassword'], r)
        }, {
            path: 'paymentpassword',
            name: '提款密码',
            component: r => require(['@/page/paymentpassword'], r)
        }, {
            path: 'moreSetting',
            component: r => require(['@/page/moreSetting'], r)
        }, {
            path: 'wallet',
            component: r => require(['@/page/wallet'], r)
        }, {
            path: 'withdrawals/:type',
            component: r => require(['@/page/withdrawals'], r)
        }, {
            path: 'replace',
            component: r => require(['@/page/replace'], r)
        }, {
            path: 'record',
            component: r => require(['@/page/record'], r)
        }, {
            path: 'coupon',
            component: r => require(['@/page/coupon'], r)
        }, {
            path: 'collection',
            component: r => require(['@/page/collection'], r)
        }, {
            path: 'feedbackfeedback',
            component: r => require(['@/page/feedbackfeedback'], r)
        }, {
            path: 'join',
            component: r => require(['@/page/join'], r)
        }, {
            path: 'application',
            component: r => require(['@/page/application'], r)
        }, {
            path: 'creditinquiry',
            component: r => require(['@/page/creditinquiry'], r)
        }, {
            path: 'litigation',
            component: r => require(['@/page/litigation'], r)
        }, {
            path: 'blacklist',
            component: r => require(['@/page/blacklist'], r)
        }, {
            path: 'security',
            component: r => require(['@/page/security'], r)
        }, {
            path: 'recharge',
            component: r => require(['@/page/recharge'], r)
        },{
            path:'agreement',
            component: r => require(['@/page/agreement'],r)
        },{
            path:'Ishare',
            component: r => require(['@/page/Ishare'],r)
        }]
    },
    //信用卡
    {
        path: '/',
        component: App,
        children: [{
            path: 'mycard',
            component: r => require(['@/page/mycard'], r)
        }, {
            path: 'addcard',
            component: r => require(['@/page/addcard'], r)
        }, {
            path: 'creditcard',
            component: r => require(['@/page/creditcard'], r)
        }, {
            path: 'cardform/:id',
            component: r => require(['@/page/cardform'], r)
        }, {
            path: 'cardpayment',
            component: r => require(['@/page/cardpayment'], r)
        }, {
            path: 'bill',
            component: r => require(['@/page/bill'], r)
        }, {
            path: 'addcreditcards',
            component: r => require(['@/page/addcreditcards'], r)
        }, {
            path: 'stewardship',
            component: r => require(['@/page/stewardship'], r)
        }]
    },
    //other
    {
        path: '/',
        component: App,
        children: [{
            path: 'servicereminding',
            component: r => require(['@/page/servicereminding'], r)
        }, {
            path: 'enterprise',
            component: r => require(['@/page/enterprise'], r)
        }, {
            path: 'successcase',
            component: r => require(['@/page/successcase'], r)
        }, {
            path: 'negative',
            component: r => require(['@/page/negative'], r)
        }, {
            path: 'recommending',
            component: r => require(['@/page/recommending'], r)
        }, {
            path: 'recommending/:id',
            component: r => require(['@/page/recommending'], r)
        }, {
            path: 'cooperation',
            component: r => require(['@/page/cooperation'], r)
        }, {
            path: 'article/:id',
            component: r => require(['@/page/article'], r)
        }, {
            path: 'participate',
            component: r => require(['@/page/participate'], r)
        }, {
            path: 'us',
            component: r => require(['@/page/us'], r)
        }, {
            path: 'news',
            component: r => require(['@/page/news'], r)
        }]
    },
    //loans
    {
        path: '/',
        component: App,
        children: [{
            path: 'loanapplication',
            component: r => require(['@/page/loanapplication'], r)
        }, {
            path: 'loanapplication/:id',
            component: r => require(['@/page/loanapplication'], r)
        }, {
            path: 'notification',
            component: r => require(['@/page/notification'], r)
        }, {
            path: 'detailedinquiry/:id',
            component: r => require(['@/page/detailedinquiry'], r)
        }, {
            path: 'supplementmaterials',
            component: r => require(['@/page/supplementmaterials'], r)
        }, {
            path: 'customerservice',
            component: r => require(['@/page/customerservice'], r)
        }, {
            path: 'cancelloan',
            component: r => require(['@/page/cancelloan'], r)
        }, {
            path: 'loanproducts',
            component: r => require(['@/page/loanproducts'], r)
        }, {
            path: 'apply/:id',
            component: r => require(['@/page/apply'], r)
        }, {
            path: 'creditmanager',
            component: r => require(['@/page/creditmanager'], r)
        }, {
            path: 'releaseevaluation/:id',
            component: r => require(['@/page/releaseevaluation'], r)
        }, {
            path: 'complaint',
            component: r => require(['@/page/complaint'], r)
        }, {
            path: 'accumulation',
            component: r => require(['@/page/accumulation'], r)
        }, {
            path: 'business',
            component: r => require(['@/page/business'], r)
        }, {
            path: 'personal',
            component: r => require(['@/page/personal'], r)
        }, {
            path: 'guarantee',
            component: r => require(['@/page/guarantee'], r)
        }, {
            path: 'repaying',
            component: r => require(['@/page/repaying'], r)
        }, {
            path: 'Mloan/:id',
            component: r => require(['@/page/Mloan'], r)
        }, {
            path: 'Cloan',
            component: r => require(['@/page/Cloan'], r)
        }, {
            path: 'Pdeposit/:id',
            component: r => require(['@/page/Pdeposit'], r)
        }, {
            path: 'Smaterial/:id',
            component: r => require(['@/page/Smaterial'], r)
        }, {
            path: 'Pcost/:id',
            component: r => require(['@/page/Pcost'], r)
        }, {
			path: 'sign',
			component: r => require(['@/components/signature'], r)
		}]
    }
]

const router = new Router({
    mode: 'history',
    routes
})

export default router